package com.binest.projectInvestDetails.mapper;

import java.util.List;
import com.binest.projectInvestDetails.domain.ProjectInvestDetails;
import com.binest.projectInvestDetails.domain.ProjectInvestDetailsInvestors;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 项目投资机构详情Mapper接口
 * 
 * @author wwd
 * @date 2024-01-24
 */
@Mapper
public interface ProjectInvestDetailsMapper 
{
    /**
     * 查询项目投资机构详情
     * 
     * @param id 项目投资机构详情主键
     * @return 项目投资机构详情
     */
    ProjectInvestDetails selectProjectInvestDetailsById(String id);
    List<ProjectInvestDetails> selectProjectInvestDetailsListByInId(String inclousionId);
    /**
     * 查询项目投资机构详情列表
     * 
     * @param projectInvestDetails 项目投资机构详情
     * @return 项目投资机构详情集合
     */
    List<ProjectInvestDetails> selectProjectInvestDetailsList(ProjectInvestDetails projectInvestDetails);

    /**
     * 新增项目投资机构详情
     * 
     * @param projectInvestDetails 项目投资机构详情
     * @return 结果
     */
    int insertProjectInvestDetails(ProjectInvestDetails projectInvestDetails);

    /**
     * 修改项目投资机构详情
     * 
     * @param projectInvestDetails 项目投资机构详情
     * @return 结果
     */
    int updateProjectInvestDetails(ProjectInvestDetails projectInvestDetails);

    /**
     * 删除项目投资机构详情
     * 
     * @param id 项目投资机构详情主键
     * @return 结果
     */
    int deleteProjectInvestDetailsById(String id);

    /**
     * 批量删除项目投资机构详情
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    int deleteProjectInvestDetailsByIds(String[] ids);
    @Select("select e.name,e.type,e.project_id as investorId from inclusion_examine e  " +
            " left join   project_invest_details s on FIND_IN_SET(e.project_id,s.investor) " +
            "where s.id =#{id}")
    List<ProjectInvestDetailsInvestors> selectProjectInvestDetailsInvestorsByPId(@Param("id") String id);
    @Update("update project_invest_details set investor = REPLACE(investor,#{oldId},#{oldId})")
    int updateInvestorProjectId(@Param("oldId")String oldProjectId, @Param("newId")String newProjectId);
}
